# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=bison
pkgver=3.4.2
pkgrel=1
pkgdesc="The GNU general-purpose parser generator"
arch=('i686' 'x86_64')
license=('GPL3')
url="https://www.gnu.org/software/bison/bison.html"
depends=('m4' 'sh')
groups=('base-devel')
options=('staticlibs')
makedepends=('flex')
install=bison.install
source=(https://ftp.gnu.org/gnu/bison/${pkgname}-${pkgver}.tar.xz{,.sig}
        bison-3.1-msys2.patch)
sha256sums=('27d05534699735dc69e86add5b808d6cb35900ad3fd63fa82e3eb644336abfa0'
            'SKIP'
            'df696884791ef28f6b7fc1fa4df1d4c1e0084e419c31535dfcecf2a779701a08')
validpgpkeys=('7DF84374B1EE1F9764BBE25D0DDCAA3278D5264E')  # Akim Demaille


prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}
  patch -p1 -i ${srcdir}/bison-3.1-msys2.patch

  autoreconf -vfi
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  ./configure --prefix=/usr
  make
}

check() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make check
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install
}
